﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>树干树叶模式</title>
    <!--SQL编辑器-->
    <link href="../../../Scripts/CodeMirror/lib/codemirror.css" rel="stylesheet" />
    <link href="../../../Scripts/CodeMirror/addon/hint/show-hint.css" rel="stylesheet" />
    <script src="../../../Scripts/CodeMirror/lib/codemirror.js"></script>
    <script src="../../../Scripts/CodeMirror/addon/edit/matchbrackets.js"></script>
    <script src="../../../Scripts/CodeMirror/mode/sql/sql.js"></script>
    <script src="../../../Scripts/CodeMirror/addon/hint/show-hint.js"></script>
    <script src="../../../Scripts/CodeMirror/addon/hint/sql-hint.js"></script>
    <script src="../../../Scripts/LoadSql.js"></script>
    <script type="text/javascript" src="../../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
    <link href="../../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../../Comm/Gener.js"></script>
    <script src="DDLBar.js" type="text/javascript"></script>

    <script type="text/javascript" language="javascript">
        //页面启动函数.
        $(function () {

            InitBar("PopBranchesAndLeaf");

            var html = "";
            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "PopBranchesAndLeaf_" + GetQueryString("FK_MapData") + "_" + GetQueryString("KeyOfEn");
            var i = mapExt.RetrieveFromDBSources(); //从数据库来查询.

            if (i == 0) {

                mapExt.H = 500;
                mapExt.W = 900;
                mapExt.SetPara("Title", "请选择");

                mapExt.SetPara("SelectType", 0);
                mapExt.Doc = "@WebUser.FK_Dept";
            }

            if (mapExt.W <= 400)
                mapExt.W = 900;


            //批量为复制.
            GenerFullAllCtrlsVal(mapExt);

            $("#Btn_Delete").show();
            $("#Btn_FullData").show();

            //设置按钮是否可以用?
            if (i == 0) {
                $("#Btn_Delete").hide();
                $("#Btn_FullData").hide();
                $("#Btn_Gener").hide();
            }
        });
        function Save() {

            //更新节点表单类型.
            var frmID = GetQueryString("FK_MapData");
            var keyOfEn = GetQueryString("KeyOfEn");

            var en = new Entity("BP.Sys.MapAttr", frmID + "_" + keyOfEn);
            en.SetPara("PopModel", "PopBranchesAndLeaf");
            en.Update();

            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "PopBranchesAndLeaf_" + GetQueryString("FK_MapData") + "_" + GetQueryString("KeyOfEn");
            var count = mapExt.RetrieveFromDBSources(); //从数据库来查询.
            if (count == 0) {
                mapExt.SetPara("OpenPopType", 0);
                mapExt.SetPara("SelectType", 1);
            } else {
                if (mapExt.GetPara("OpenPopType") == undefined)
                    mapExt.SetPara("OpenPopType", 0);
                if (mapExt.GetPara("SelectType") == undefined)
                    mapExt.SetPara("SelectType", 1);
            }
            mapExt.CopyURL();  //从url里面copy数据.
            mapExt.CopyForm(); //从from里面copy数据.

            mapExt.ExtType = "PopBranchesAndLeaf";
            mapExt.AttrOfOper = GetQueryString("KeyOfEn");

            var err = "";

            if (mapExt.GetPara("TBPara_Title") == "")
                err += '\t\n必填字段[标题]不能为空';

            if (mapExt.Tag1 == "")
                err += '\t\n必填字段[搜索数据源]不能为空';

            if (mapExt.Tag2 == "")
                err += '\t\n必填字段[左侧树列表数据源]不能为空';

            if (mapExt.Tag == "")
                err += '\t\n必填字段[数据列名与中文意思对照]不能为空';

            if (mapExt.DBType == "")
                err += '\t\n必填字段[数据源类型]不能为空';

            var val = mapExt.Save();

            Reload();
        }
        function Delete() {

            if (confirm('您确定要删除吗？') == false)
                return;

            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "PopBranchesAndLeaf_" + GetQueryString("FK_MapData") + "_" + GetQueryString("KeyOfEn");
            mapExt.RetrieveFromDBSources(); //从数据库来查询.
            mapExt.Delete();

            Reload();
        }

    </script>
    <style type="text/css">
        .style1 {
            height: 21px;
        }

        #bar {
            text-align: left;
        }

        .cs-content-box {
            padding: 0 5px;
        }
        .table a{ color:#1c60be}
        .table ul {
            padding: 10px 0px;
        }
        .table li {
            list-style-type: none;
            line-height:26px;
        }
    </style>
</head>
<body>
    <div class="container-full">
        <div id="bar">
        </div>
        <form id="cc">
            <table id="Table1" class="table">
                <tr>
                    <td>
                        <a href="javascript:ShowHidden('HSearch')">搜索提示</a>
                        <div id="HSearch" style="color: Gray; display: none">
                            <ul>
                                <li>显示在搜索文本框的背景文字，比如:</li>
                                <li>请输入付款人名称,进行搜索.</li>
                                <li>输入人员编号,名称，名称全拼,简拼关键字搜索.</li>
                            </ul>
                        </div>
                    </td>
                    <td>
                        <input type="text" id="TBPara_SearchTip" name="TBPara_SearchTip" style="width: 99%;" />
                    </td>
                </tr>

                <tr>
                    <td colspan="2">
                        <a href="javascript:ShowHidden('PopValSearchCond')">搜索数据源</a>
                        <div id="PopValSearchCond" style="color: Gray; display: none">
                            <ul>
                                <li>点击关键字执行搜索返回的数据源，@Key是关键字,是搜索的关键字.</li>
                                <li>For URL:/DataUser/Handler.ashx?DoType=SearchEmps&Keyword=@Key</li>
                                <li>
                                    For SQL: SELECT No,Name FROM Port_Emp WHERE No like '%@Key%' OR Name like '%@Key%'
                                </li>
                            </ul>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <textarea id="TB_Tag1" name="TB_Tag1" style="width: 98%; height: 23px;"></textarea>
                    </td>
                </tr>
                <!-- 左侧树列表数据源  -->
                <tr>
                    <td colspan="2">
                        <a href="javascript:ShowHidden('tab2')">左侧树列表数据源</a>
                        <div id="tab2" style="color: Gray; display: none">
                            <ul>
                                <li>设置一个可以返回json的数据源该数据源有No,Name,ParentNo三个约定的列. </li>
                                <li>For URL:/DataUser/Handler.ashx?DoType=ReqDepts</li>
                                <li>For SQL:SELECT No,Name, ParentNo FROM Port_Dept</li>
                            </ul>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <textarea id="TB_Tag2" name="TB_Tag2" style="width: 98%; height: 23px;"></textarea>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        根目录树编号:<input id="TB_Doc" name="TB_Doc" value="0" style="width: 250px;" type="text" />
                        <a href="javascript:ShowHidden('h1')">帮助</a>
                        <div id="h1" style="color: Gray; display: none">
                            支持ccbpm的表达式,比如:@WebUser.FK_Dept , @FieldName ,@WebUser.OrgNo
                        </div>
                    </td>
                </tr>
                <!-- 右上列表信息数据源 ------------------------------------------------ -->
                <tr>
                    <td colspan="2">
                        <a href="javascript:ShowHidden('tab4')">右上列表信息数据源(点左边树一个节点查询数据源)</a>
                        <div id="tab4" style="color: Gray; display: none">
                            <ul>
                                <li>选择右边的树返回的详细信息列表数据源 ， @Key是关键字,是选择的树节点编号. </li>
                                <li>For URL:/DataUser/Handler.ashx?DoType=ReqEmpsByDeptNo&DeptNo=@Key </li>
                                <li>For SQL:SELECT No,Name FROM Port_Emp WHERE FK_Dept='@Key' </li>
                            </ul>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <textarea id="TB_Tag3" name="TB_Tag3" style="width: 98%; height: 23px;"></textarea>
                    </td>
                </tr>
               
                <!-- 数据列名与中文意思对照  &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&-->
                <tr>
                    <td colspan="2">
                        <a href="javascript:ShowHidden('tab6')">数据列名与中文意思对照</a>,可以为空.
                        <div id="tab6" style="color: Gray; display: none">
                            <ul>
                                <li>该选项可以为空,在右上角的列表里查询或点树树干的数据源出现的列表,需要用中文显示列头.</li>
                                <li>例如: No=编号,Name=名称,Addr=地址,Tel=电话,Email=邮件</li>
                            </ul>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <textarea id="TB_Tag" name="TB_Tag" style="width: 98%; height: 23px;"></textarea>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <a href="javascript:ShowHidden('backFunction')">确定后执行的JS</a>,可以为空.
                        <div id="backFunction" style="color: Gray; display: none">
                            <ul>
                                <li>该选项可以为空,弹出框确定后执行的JS，可以直接写方法名或者方法. </li>
                            </ul>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <textarea id="TB_Tag5" name="TB_Tag5" style="width: 98%; height: 23px;"></textarea>
                    </td>
                </tr>
            </table>

            <fieldset>
                <legend id="help"></legend>
                <ul>
                    <li><font color="red"> 返回的数据，都要区分大小写，并且所有的SQL ，都要按照顺序进行。</font>  </li>
                    <li><font color="red"> 如果没有No,Name列，您需要 xxx AS No, xxxx AS Name 的方式来书写表达式. </font>  </li>

                    <li> <img alt="" src='1.BranchesAndLeaf.png' onclick="WinOpen('1.BranchesAndLeaf.png')" style="width: 500px;" /> </li>
                </ul>
            </fieldset>
        </form>
    </div>
</body>
</html>
